package com.lixw.study.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lixw.study.annotations.RedisCache;
import com.lixw.study.entity.User;
import com.lixw.study.service.UserService;
import com.lixw.study.mapper.UserMapper;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

import java.io.Serializable;

/**
* @author lixw
* @description 针对表【t_user(用户表)】的数据库操作Service实现
* @createDate 2025-07-31 09:45:43
*/
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User>
    implements UserService{

    @Resource
    private UserMapper userMapper;

    @Override
    @RedisCache(keyPrefix = "user",matchValue = "#id")
    public User getById(Serializable id) {
        return userMapper.selectById(id);
    }

    @Override
    public boolean updateById(User entity) {
        return userMapper.updateById(entity)>0;
    }
}




